home *** CD-ROM | disk | FTP | other *** search
- /*
- File: DspUtilM.h
-
- Contains: Dispatcher utilities.
-
- Owned by: Richard Rodseth
-
- Copyright: © 1995 - 1996 by Apple Computer, Inc., all rights reserved.
-
- Change History (most recent first):
-
- <2> 6/12/96 eeh 1316602: add modifiers param to SetEvent
- <4> 8/29/95 RR #1267251 Utilites for synthsized activate
- events
- <3> 5/25/95 jpa Fixed usage of ODDebug. [1253321]
- <2> 5/10/95 RR # 1239139 Added LogEvent, and
- GetActiveFacetWithBorderUnderPoint
-
- To Do:
- In Progress:
- */
-
- #ifndef _DSPUTILM_
- #define _DSPUTILM_
-
- #ifndef _ODTYPES_
- #include "ODTypes.h"
- #endif
-
- const kODGeneratedActivate = 0x0002;
-
- class ODFacet;
- class ODFrame;
- class ODWindow;
-
- void WindowToLocal(Environment* ev, ODPoint& point, ODFacet* facet);
-
- ODFacet* GetActiveFacetWithBorderUnderPoint(Environment* ev, ODFrame* frame, ODWindow* window, ODPoint& windowPoint);
-
- inline long Min(long a, long b)
- {
- return a < b ? a : b;
- }
-
- #if 0 /* not used */
- inline void SetEvent(ODEventData& event, short what)
- {
- event.what = what;
- event.message = 0;
- event.when = 0;
- event.where.h = 0; event.where.v = 0;
- event.modifiers = 0;
- }
- #endif
-
- inline void SetEvent(ODEventData& event, short what, Point globalWhere,
- ODSShort modifiers)
- {
- event.what = what;
- event.message = 0;
- event.when = 0;
- event.where.h = globalWhere.h; event.where.v = globalWhere.v;
- event.modifiers = modifiers;
- }
-
- inline void SetActivateEvent(ODEventData& event, WindowPtr window, ODBoolean activate)
- {
- event.what = activateEvt;
- event.message = (long) window;
- event.when = 0;
- event.where.h = 0; event.where.v = 0;
- if (activate)
- event.modifiers = 1 | kODGeneratedActivate;
- else
- event.modifiers = 0 | kODGeneratedActivate;
- }
-
- inline ODBoolean IsODActivateEvent(ODEventData& event)
- {
- return (event.modifiers & kODGeneratedActivate);
- }
-
- inline void SetEventInfo(ODEventInfo& info, ODPoint where)
- {
- info.embeddedFrame = kODNULL;
- info.embeddedFacet = kODNULL;
- info.where = where;
- info.propagated = kODFalse;
- }
-
- #if ODDebug
- void LogEvent(ODEventData* event, ODEventInfo* eventInfo, ODFrame* frame, ODFacet* facet);
- #endif
-
- #endif // _DSPUTILM_